package com.lzw.service.impl.maintenance;

import com.lzw.mapper.maintenance.MaintenanceWorkerMapper;
import com.lzw.service.maintenance.MaintenanceWorkerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class MaintenanceWorkerServiceImpl implements MaintenanceWorkerService {

    @Autowired
    private MaintenanceWorkerMapper maintenanceWorkerMapper;

    @Override
    public boolean login(String username, String password) {
        return maintenanceWorkerMapper.checkCredentials(username, password) != null;
    }

    @Override
    public Map<String, Object> getMaintenanceInfo(String username, String password) {
        return maintenanceWorkerMapper.getMaintenanceInfo(username, password);
    }

    @Override
    public Map<String, Object> getMaintenanceInfoById(Integer workerId) {
        return maintenanceWorkerMapper.getMaintenanceInfoById(workerId);
    }

    @Override
    public boolean updateMaintenanceInfo(Integer workerId, String name, String gender, String phone, String email) {
        return maintenanceWorkerMapper.updateMaintenanceInfo(workerId, name, gender, phone, email) > 0;
    }
}
